package com.nw.controller;

import com.nw.entity.Category;
import com.nw.service.CategoryService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;

@RestController
@RequestMapping("category")
public class CategoryController {
    @Resource
    CategoryService categoryService;
    //参数 categoryId categoryNameLevel1 categoryLevel
    @RequestMapping("add")
    public HashMap<String, Object> addCategoryLevel1(Category category){
        HashMap<String, Object> map = categoryService.addCategoryLevel1(category);
        return map;
    }
    //参数 categoryNameLevel1
    @RequestMapping("delete")
    public HashMap<String, Object> deleteCategoryLevel1(Category category){
        HashMap<String, Object> map = categoryService.deleteCategoryLevel1(category);
        return map;
    }
    //参数 categoryId categoryNameLevel1
    @RequestMapping("update")
    public HashMap<String, Object> updateCategoryLevel1(Category category){
        HashMap<String, Object> map = categoryService.updateCategoryLevel1(category);
        return map;
    }
    @RequestMapping("queryAll")
    public HashMap<String, Object> queryCategoryLevel1(){
        HashMap<String, Object> map = categoryService.queryCategoryLevel1();
        return map;
    }
}
